<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″/>
	<link rel="stylesheet" type="text/css" href="../../css/defaultcss.css" />
	<link rel="stylesheet" type="text/css" href="../../css/amazeui.min.css" />
	<script type="text/javascript" src="../../js/jquery-1.9.1.min.js"></script>
	<script src='../../js/amazeui.min.js'></script>
	<script src='../../js/flex.js'></script>
	<script src='../../js/index.js'></script>
	<script type="text/javascript" src="../../layer/layer.js"></script>
	<link rel="stylesheet" href="../../css/weui.min.css">
	<link rel="stylesheet" href="../../css/css/stylesheets/index.css">

</head>

<body>
	<header>
		<div class="goBack">
			<img src="../../img/base/back.png" alt="返回">
		</div>
		<span class="title"> 案件信息 </span>
	</header>
	<div class="content  case_detail">
		<div class="title">
			基本信息
		</div>
		<div class="detail_box">
			<ul class="detail_ul">
				<li>
					<div class="li_label">
						案件名称
					</div>
					<div class="li_detail" id="caseName">
					</div>
				</li>
				<li>
					<div class="li_label">
						当事人名字
					</div>
					<div class="li_detail" id="party">
					</div>
				</li>
				<li>
					<div class="li_label">
						案件类型
					</div>
					<div class="li_detail" id="caseType">
					</div>
				</li>
				<li>
					<div class="li_label">
						承办人员
					</div>
					<div class="li_detail" id="contractor">
					</div>
				</li>
				<li>
					<div class="li_label">
						承办单位
					</div>
					<div class="li_detail" id="contractorUnit">
					</div>
				</li>
				<li>
					<div class="li_label">
						受理日期
					</div>
					<div class="li_detail" id="acceptDate">
					</div>
				</li>
				<li>
					<div class="li_label">
						案件状态
					</div>
					<div class="li_detail" id="caseState">
					</div>
				</li>
				<div class="li_title1">
					案件详情
				</div>
				<div class="detail" id="content">
				</div>
			</ul>
		</div>
		<div class="application_enquiry  apply_table">
			<div class="apply_title">
				申请表
			</div>
			<form id="fform">
				<ul class="form_ul">
					<li>
						<label for="">申请人</label>
						<input type="text" name="applyName" id="applyName" placeholder="">
					</li>
					<li class="type ">
						<label for="type">申请操作</label>
						<select data-am-selected required id="type">
							<option value="1">申请阅卷</option>
							<option value="2">申请会见</option>
							<option value="3">申请收集（调取）证据材料</option>
							<option value="4">申请自行收取证据材料</option>
							<option value="5">申请变更（解除）强制措施</option>
							<option value="6">提供证据材料</option>
							<option value="7">要求听取意见</option>
							<option value="8">其他</option>
						</select>
					</li>
					<li>
						<label for="">承办人</label>
						<input type="text" name="undertaker" id="undertaker" placeholder="">
					</li>
					<li style="display:none;">
						<input type="text" name="caseId" id="caseId" placeholder="">
					</li>
				</ul>
			</form>
			<div class="submitBtn">
				<button class="button" type="submit" id="submit">
						提交申请
					</button>
			</div>
		</div>
	</div>
	<div class="am-modal am-modal-alert radiusModal" tabindex="-1" id="lawsuitModal">
		<div class="am-modal-dialog">
			<div class="am-modal-hd">温馨提示</div>
			<div class="am-modal-bd">
				申请表已提交
				</br>请等待反馈!
			</div>
			<div class="am-modal-footer">
				<a href='./mine_book.html' class="am-modal-btn">确定</a>
			</div>
		</div>
	</div>
</body>

</html>

<script type="text/javascript ">
	$('.goBack').bind('click', function () {
		window.history.back()
	})

	var getData = function (id) {
		HYIP.ajax({
			url: '/lawyerCase/lawyerCaseInfo.action',
			type: 'get',
			data: {
				id: id
			}
		}, function (data) {
			var detail = data.data;
			$('#caseName').text(detail.caseName);
			$('#party').text(detail.party);
			$('#caseType').text(detail.caseType);
			$('#contractor').text(detail.contractor);
			$('#contractorUnit').text(detail.contractorUnit);
			$('#acceptDate').text(detail.acceptDate);
			$('#caseState').text(detail.caseState);
			$('#content').text(detail.content);
			$('#createTime').text(detail.createTime);
		});
	}

	function GetRequest() {
		var url = location.search; //获取url中"?"符后的字串
		var theRequest = new Object();
		if (url.indexOf("?") != -1) {
			var str = url.substr(1);
			strs = str.split("&");
			for (var i = 0; i < strs.length; i++) {
				theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
			}
		}
		return theRequest;
	}
	getData(GetRequest()['id']);
	console.log(GetRequest()['id'])

	//提交申请表
	var type = $("#type").val();
	$("#type").change(function () {
		type = $("#type").val();
	});
	$("#submit").bind('click', function () {
		var applyName = $("#applyName").val();
		var undertaker = $('#undertaker').val();
		$('#caseId').val(GetRequest()['id'])
		console.log(applyName, undertaker, type, $('#caseId').val())
		if (applyName == "") {
			layer.open({
				title: '提示',
				content: "姓名不能为空！",
				btn: ['确定'],
			});
			return false;
		} else if (type == "") {
			layer.open({
				title: '提示',
				content: "预约类型不能为空！",
				btn: ['确定'],
			});
			return false;
		} else if (undertaker == "") {
			layer.open({
				title: '提示',
				content: "承办人不能为空！",
				btn: ['确定'],
			});
			return false;
		}
		var form = new FormData($('#fform')[0]);
		HYIP.ajax({
			url: '/lawyerCase/applyBooking.action',
			type: 'post',
			processData: false,
			data: form
		}, function (data) {
			$("#lawsuitModal").modal('open');
		});
		return false;
	})
</script>